//
//  BaseRequest+Buy.m
//  忘不了
//
//  Created by rimi on 16/7/11.
//  Copyright © 2016年 handuan. All rights reserved.
//

#import "BaseRequest+Buy.h"
#import <AVOSCloud/AVOSCloud.h>
@implementation BaseRequest (Buy)
+ (void)startGetProductsWithType:(NSString *)type completionhanlder:(RequestCompletion)callBack{
    AVQuery *query = [AVQuery queryWithClassName:type];
     Response *response = [[Response alloc]init];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        NSArray<AVObject *> *todos = objects;
        NSLog(@"%@",todos);
        NSMutableArray *data = @[].mutableCopy;
        if (todos.count > 0) {
            for (AVObject *todo in todos) {
                [data addObject:todo[@"name"]];
            }
            response.isSuccess = YES;
            response.resultObject = data;
        }
        NSLog(@"%@",data);
        callBack(response);
    }];

}
@end
